<?php /* Smarty version Smarty-3.1.8, created on 2012-06-14 20:58:04
         compiled from "tmpl/crud_template/controller_helper.html" */ ?>
<?php /*%%SmartyHeaderCode:4581715734fc6e28be035c5-93343810%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    'ed72911a15d72c4da2a4b0047165e26911b81894' => 
    array (
      0 => 'tmpl/crud_template/controller_helper.html',
      1 => 1339732681,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '4581715734fc6e28be035c5-93343810',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.8',
  'unifunc' => 'content_4fc6e28be0c9a9_23425221',
  'variables' => 
  array (
    'table' => 0,
    'table_cols' => 0,
    'col' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_4fc6e28be0c9a9_23425221')) {function content_4fc6e28be0c9a9_23425221($_smarty_tpl) {?><<?php ?>?php

function get_database_handler(){
 return get_db("<?php echo $_smarty_tpl->tpl_vars['table']->value;?>
");
}

function create_table(){
  $db=get_database_handler();
  $db->exec("DROP TABLE IF EXISTS `<?php echo $_smarty_tpl->tpl_vars['table']->value;?>
`");
  echo "DROP TABLE IF EXISTS `<?php echo $_smarty_tpl->tpl_vars['table']->value;?>
`";
  $db->exec("
    CREATE  TABLE IF NOT EXISTS `<?php echo $_smarty_tpl->tpl_vars['table']->value;?>
` (
    `id` INT NOT NULL AUTO_INCREMENT ,
    <?php  $_smarty_tpl->tpl_vars['col'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['col']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['table_cols']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['col']->key => $_smarty_tpl->tpl_vars['col']->value){
$_smarty_tpl->tpl_vars['col']->_loop = true;
?>
    <?php if ($_smarty_tpl->tpl_vars['col']->value!="id"){?>`<?php echo $_smarty_tpl->tpl_vars['col']->value;?>
` VARCHAR(30),<?php }?>
    <?php } ?>
    PRIMARY KEY (`id`) )
  ");
  echo "
    CREATE  TABLE IF NOT EXISTS `<?php echo $_smarty_tpl->tpl_vars['table']->value;?>
` (
    `id` INT NOT NULL AUTO_INCREMENT ,
    <?php  $_smarty_tpl->tpl_vars['col'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['col']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['table_cols']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['col']->key => $_smarty_tpl->tpl_vars['col']->value){
$_smarty_tpl->tpl_vars['col']->_loop = true;
?>
    <?php if ($_smarty_tpl->tpl_vars['col']->value!="id"){?>`<?php echo $_smarty_tpl->tpl_vars['col']->value;?>
` VARCHAR(30),<?php }?>
    <?php } ?>
    PRIMARY KEY (`id`) )
  ";
}


?<?php ?>><?php }} ?>